package com.jinly.ryder.monitor.service.model;

import com.jinly.ryder.common.service.model.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ServiceStatus implements BaseEnum {

    UNKNOWN("UNKNOWN", "未知"),
    UP("UP", "在线"),
    DOWN("DOWN", "离线"),
    ;

    private String code;
    private String name;

    public static ServiceStatus of(String code) {
        if (UP.code.equals(code)) {
            return UP;
        }
        if (DOWN.code.equals(code)) {
            return DOWN;
        }
        return UNKNOWN;
    }
}
